package com.oracle.controller;

import com.oracle.annotation.Action;
import com.oracle.annotation.ActionType;
import com.oracle.log.service.api.LogServiceApi;
import com.oracle.vo.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

@Controller
@RequestMapping("/admin/log")
public class LogController {

    @Autowired(required = false)
    private LogServiceApi logServiceApi;

    @Action(ActionType.PAGE_JUMPS)
    @RequestMapping("/logview")
    public String logView(){
        return "admin/log/list";
    }

    @Action(ActionType.QUERY)
    @RequestMapping("/list")
    @ResponseBody
    public List<Map<String,Object>> logList(){
        ResultEntity<List<Map<String,Object>>> resultEntity = this.logServiceApi.getExecuteTypeAndCount();
        List<Map<String,Object>> mapList = resultEntity.getData();
        return mapList;
    }


}
